package com.lzx.controller;

import com.lzx.model.Qixiangshuju;
import com.lzx.service.QxsjService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
@RequestMapping("")
public class IndexController {
    @Autowired
    QxsjService qxsjService;

    @RequestMapping("/index")
    public ModelAndView index() throws Exception {
        ModelAndView mv = new ModelAndView("system/index");
        return mv;
    }

    @RequestMapping("/second")
    public ModelAndView second(HttpServletRequest request) throws Exception {
        String place = request.getParameter("place");
        String name = request.getParameter("name");
        ModelAndView mv = new ModelAndView("system/second");
        List<Qixiangshuju> findqxsj = qxsjService.findqxsj(place);
        mv.addObject("name", name);
        mv.addObject("list", findqxsj);
        return mv;
    }


}
